{% extends 'common/base.html' %}

{% block head %}
    <link rel="stylesheet" href="{{ url_for('blog.static', filename='prism/themes/prism-one-dark.css') }}">
    <script type="text/javascript" src="{{ url_for('blog.static', filename='prism/prism.js') }}"></script>
    <link rel="stylesheet"
          href="{{ url_for('blog.static', filename='prism/plugins/line-numbers/prism-line-numbers.min.css') }}">
    <script type="text/javascript"
            src="{{ url_for('blog.static', filename='prism/plugins/line-numbers/prism-line-numbers.min.js') }}"></script>
    <meta name="referrer" content="no-referrer"/>
{% endblock %}}

{% block content %}
    <div class="layui-container">
        <div class="layui-row layui-col-space15">
            {# 中心区内容 #}
            <div class="layui-col-md9">

                <div class="post-card">
                    <div class="post-title">
                        <h1>{{ post.title }}</h1>
                    </div>
                    <div class="post-msg">
                        <span>
                            <i class="layui-icon">&#xe612;</i>
                            <span>北枫</span>
                        </span>
                        <span>
                            <i class="layui-icon">&#xe705;</i>
                            <a href="#">{{ post.category.name }}</a>
                        </span>
                        <span>
                            <i class="layui-icon">&#xe68d;</i>
                            <span>{{ post.add_time | strftime }}</span>
                        </span>
                        <span>
                            <i class="layui-icon">&#xe62c;</i>
                            <span>{{ post.read_count }}</span>
                        </span>

                        <span>
                            {% if post.tags %}
                                <i class="layui-icon">&#xe674;</i>
                                {% for tag in post.tags %}
                                    <a class="layui-btn layui-btn-xs layui-btn-primary" href="#"
                                       style="color: {{ tag.color }}; margin-left: 4px; margin-bottom: 2px">{{ tag.name }}</a>
                                {% endfor %}
                            {% endif %}
                        </span>
                    </div>
                    <div class="post-content">
                        {{ post.content_html | safe }}
                    </div>

                    <div class="post-tag">
                        <div>
                            {% if prev_post %}
                                <a href="{{ url_for('blog.post',post_id=prev_post.id) }}">上一篇：{{ prev_post.title }}</a>
                            {% else %}
                                <span>上一篇：没有上一篇了~</span>
                            {% endif %}
                        </div>
                        <div>
                            {% if next_post %}
                                <a href="{{ url_for('blog.post',post_id=next_post.id) }}">下一篇：{{ next_post.title }}</a>
                            {% else %}
                                <span>下一篇：没有下一篇了~</span>
                            {% endif %}
                        </div>
                    </div>

                    {% include 'common/module/comment_edit.html' %}
                    {% include 'common/module/comment_list.html' %}
                </div>

            </div>
            {# 右边侧边栏 #}
            <div class="layui-col-md3">
                <div style="height:800px; width: 100%;">
                    {% include 'common/module/search.html' %}
                    {% include 'common/module/my_info.html' %}
                    {% include 'common/module/categorys.html' %}
                    {% include 'common/module/recent_posts.html' %}
                    {% include 'common/module/tags.html' %}
                </div>
            </div>
        </div>
    </div>

    {% block script %}
        <script>
            // 代码块行号展示
            layui.jquery('pre').addClass("line-numbers").css("white-space", "pre-wrap");

            layui.use(function () {
                let util = layui.util;
                // 自定义固定条
                util.fixbar({
                    bgcolor: '#b0bbc0',
                });
            });
        </script>


    {% endblock %}
{% endblock %}